<%--
  Created by IntelliJ IDEA.
  User: H64
  Date: 2021/4/9
  Time: 14:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息修改</title>


<link rel="shortcut icon" href="favicon.ico"> <link href="plugins/Hplus-v.4.1.0/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="plugins/Hplus-v.4.1.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="plugins/Hplus-v.4.1.0/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="plugins/Hplus-v.4.1.0/css/animate.css" rel="stylesheet">
<link href="plugins/Hplus-v.4.1.0/css/style.css?v=4.1.0" rel="stylesheet">

<!-- 全局js -->
<script src="plugins/Hplus-v.4.1.0/js/jquery.min.js?v=2.1.4"></script>
<script src="plugins/Hplus-v.4.1.0/js/bootstrap.min.js?v=3.3.6"></script>

<script type="text/javascript">
    // 客户端端浏览器验证
    //通过验证，返回true，如果没有通过验证返回false
    function  checkMe(){
        //验证通过返回标志位
        var canSubmit = true;
        //dao操作

        //用户名验证
        var strUserName =  document.getElementById("userName").value;
        if (strUserName && strUserName.trim() != ""){
            //验证通过
            //清空提示信息
            document.getElementById("user-name-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-name-label").innerHTML="用户名不能为空 ！！";
        }
        console.log("验证结果："+canSubmit);


        //密码验证
        var strUserPsw =  document.getElementById("userPsw2").value;
        var strUserPsw2 =  document.getElementById("userPsw").value;

        if (strUserPsw && strUserPsw.trim() != ""){
            //验证通过
            //清空提示信息
            document.getElementById("user-psw-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-psw-label").innerHTML="密码不能为空 ！！";
        }

        //判断确认密码不能空
        if (strUserPsw2 && strUserPsw2.trim() != ""){
            //验证通过
            //清空提示信息
            document.getElementById("user-psw2-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-psw2-label").innerHTML="确认密码不能为空 ！！";
        }

        //两次密码要一致
        if (strUserPsw && strUserPsw2 && strUserPsw == strUserPsw2){
            //验证通过
            //清空提示信息
            document.getElementById("user-psw3-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-psw3-label").innerHTML="两次密码不一致 ！！";
        }

        <!--可选可不选-->
        //联系电话验证
        /*
        var strUserPhone =  document.getElementById("userPhone").value;
        if (strUserPhone && strUserPhone.trim() != ""){
            //验证通过
            //清空提示信息
            document.getElementById("user-phone-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-phone-label").innerHTML="联系电话不能为空 ！！";
        }
        console.log("验证结果："+canSubmit);


        //注册日期验证
        var strUserRegisterDate=  document.getElementById("userRegisterDate").value;
        if (strUserRegisterDate && strUserRegisterDate.trim() != ""){
            //验证通过
            //清空提示信息
            document.getElementById("user-registerdate-label").innerHTML="";
        }else {
            //验证不通过
            canSubmit = false;
            //信息提示
            document.getElementById("user-registerdate-label").innerHTML="注册日期不能为空 ！！";
        }
        console.log("验证结果："+canSubmit);
         */

        return canSubmit;
    }
</script>

</head>

<body>
<div class="ibox-content">
    <form action="UserInfoAddServlet" method="post" class="form-horizontal">
        <%-- 使用隐藏表单域：保存当前被修改的记录的id主键的值，因为后台使用该主键进行修改操作--%>
        <input type="hidden" id="userID" name="userID" value="${sessionScope.userInfoBean.userID}">

            <div class="form-group">
            <label class="col-sm-2 control-label">用户名</label>
            <div class="col-sm-2">
                <input type="text" id="userName" name="userName"
                       value="${sessionScope.userInfoBean.userName}" class="form-control">
                <span class="help-block m-b-none" id="user-name-label" style="color: #ff0000"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>


        <div class="form-group">
            <label class="col-sm-2 control-label">密码</label>
            <div class="col-sm-2">
                <input type="password"  id="userPsw" name="userPsw"
                       value="${sessionScope.userInfoBean.userPsw}" class="form-control">
                <span class="help-block m-b-none">密码有字母，数字，特殊符号组成</span>
                <span class="help-block m-b-none" id="user-psw-label" style="color: #ff0000"></span>

            </div>
        </div>
        <div class="hr-line-dashed"></div>


        <div class="form-group">
            <label class="col-sm-2 control-label">确认密码</label>
            <div class="col-sm-2">
                <input type="password"  id="userPsw2" name="userPsw2"
                       value="${sessionScope.userInfoBean.userPsw}"
                       class="form-control" name="password">
                <span class="help-block m-b-none" id="user-psw2-label" style="color: #ff0000"></span>
                <span class="help-block m-b-none" id="user-psw3-label" style="color: #ff0000"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="form-group">
            <label class="col-sm-2 control-label">联系电话</label>
            <div class="col-sm-2">
                <input type="text" id="userPhone" name="userPhone"
                       value="${sessionScope.userInfoBean.userPhone}"class="form-control">
                <span class="help-block m-b-none" id="user-phone-label" style="color: #ff0000"></span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>


        <div class="form-group">
            <label class="col-sm-2 control-label">注册日期</label>
            <div class="col-sm-2">
                <input type="date"  id="userRegisterDate" name="userRegisterDate"
                       value="${sessionScope.userInfoBean.userRegisterDate}" placeholder="选择注册日期" class="form-control">
                <span class="help-block m-b-none" id="user-registerdate-label" style="color: red">
                    ${sessionScope.userInfoBean.userRegisterDate}
                </span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>

        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-2">
                <button class="btn btn-primary" type="submit" onclick="return checkMe();">
                    更新内容</button>
                <%--<button class="btn btn-white" type="submit">取消</button>--%>
            </div>
        </div>
    </form>
</div>
</body>
</html>
